//
//  YRJHotAttractionsTableViewCell.m
//  TravelAroundTheWorld
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJHotAttractionsTableViewCell.h"
#define SWIDTH ([UIScreen mainScreen].bounds.size.width)
#define SHEIGH ([UIScreen mainScreen].bounds.size.height)
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation YRJHotAttractionsTableViewCell
- (void)dealloc {
    [_view release];
    [_photoImageView release];
    [_titleLabel release];
    [_replysLabel release];
    [_viewsLabel release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.view = [[UIView alloc] init];
    [self.contentView addSubview:self.view];
    [_view release];
    
    self.photoImageView = [[UIImageView alloc] init];
    [self.view addSubview:self.photoImageView];
    [_photoImageView release];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.view addSubview:self.titleLabel];
    [_titleLabel release];
    self.titleLabel.numberOfLines = 2;
    self.titleLabel.font = [UIFont systemFontOfSize:17 * (SHEIGH / 667)];
    
    self.viewsLabel = [[UILabel alloc] init];
    [self.view addSubview:self.viewsLabel];
    [_viewsLabel release];
    self.viewsLabel.font = [UIFont systemFontOfSize:12 * (SHEIGH / 667)];
    
    self.replysLabel = [[UILabel alloc] init];
    [self.view addSubview:self.replysLabel];
    [_replysLabel release];
    self.replysLabel.font = [UIFont systemFontOfSize:12 * (SHEIGH / 667)];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.view.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.photoImageView.frame = CGRectMake((5.0 / 375.0) * WIDTH, (5.0 / 124.5) * HEIGHT, (120.0 / 375.0) * WIDTH, (115.0 / 124.5) * HEIGHT);
    self.titleLabel.frame = CGRectMake((130.0 / 375.0) * WIDTH, (15.0 / 124.5) * HEIGHT, (240.0 / 375.0) * WIDTH, (60.0 / 124.5) * HEIGHT);
    self.viewsLabel.frame = CGRectMake((130.0 / 375.0 ) * WIDTH, (95.0 / 124.5 ) * HEIGHT, (100.0 / 375.0) * WIDTH, (20.0 / 124.5) * HEIGHT);
    self.replysLabel.frame = CGRectMake((270.0 / 375.0) * WIDTH, (95.0 / 124.5) * HEIGHT, (100.0 / 375.0) * WIDTH, (20.0 / 124.5) * HEIGHT);
    
//    self.view.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
//    self.photoImageView.frame = CGRectMake(5, 5, 120, 120);
//    self.titleLabel.frame = CGRectMake(130, 15, 240, 60);
//    self.viewsLabel.frame = CGRectMake(130, 95, 100, 20);
//    self.replysLabel.frame = CGRectMake(270, 95, 100, 20);
    
    NSLog(@"%f", WIDTH);
    NSLog(@"%f", HEIGHT);
}
@end
